package com.examination.exam.service.impl;

import com.examination.auth.utils.RedisCache;
import com.examination.domain.exam.entity.Examination;
import com.examination.domain.exam.vo.ExamPaperVo;
import com.examination.exam.service.ExamPaperService;
import com.examination.exam.service.ExaminationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExamPaperServiceImpl implements ExamPaperService {

    @Autowired
    private RedisCache redisCache;

    @Autowired
    private ExaminationService examinationService;

    @Override
    public ExamPaperVo getExam(String userId, String examId) {
        return redisCache.getCacheObject(userId + "_" + examId);
    }

    @Override
    public ExamPaperVo beginExam(String userId, String examId) {
        Examination examinationById = examinationService.getExaminationById(examId);
        return  null;
//        return redisCache.setCacheObject(userId + "_" + examId,);
    }
}
